using UnityEngine;

namespace skeleton
{
    public class StunnedState : State
    {
        [SerializeField] float duration;
        [SerializeField] Vector2 velocity;

        float timer;

        // ========================================================================

        public override void Enter()
        {
            base.Enter();

            timer = duration;
            skeleton.SetVelocity(skeleton.FacingDirection() * velocity.x, velocity.y);
        }

        public override void Process()
        {
            base.Process();

            timer -= Time.deltaTime;
            if(timer < 0)
            {
                skeleton.ChangeState(StateCode.Idle);
            }
        }
    }
}